//
// Created by webturing on 2024/5/4.
//
#include<bits/stdc++.h>

using namespace std;

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    int x1, y1, z1;
    cin >> x1 >> y1 >> z1;
    int a[] = {0, y1, 0, z1, 0, x1};
    vector<int> m(6);
    for (int i = 0; i < 6; i++)
        cin >> m[i];
    int sum = 0;
    if ( y < 0 )
        sum += m[0];
    else if ( y > y1 )
        sum += m[1];
    if ( x < 0 ) sum += m[4];
    else if ( x > x1 ) sum += m[5];
    if ( z < 0 ) sum += m[2];
    else if ( z > z1 ) sum += m[3];
    cout << sum;

}